/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2025-06-23     N0953692       the first version
 */
#ifndef APPLICATIONS_INA226_I2C_H_
#define APPLICATIONS_INA226_I2C_H_


//MAX_Current = Full-scale range / R·SHUNT = 81.92mV / 0.1R = 819.2mA
//Current_LSB = 819.2mA / 2^15 = 0.025mA
//选择接近值：0.05mA = 0.00005A 手册推荐1mA 但是便于CAL计算和实际调试则重新选择为 0.05mA
//(手册：While this value yields the highest resolution, it is common to select a value for the Current_LSB to the nearest round number above this value to simplify the conversion of the Current Register (04h) and Power Register (03h) to amperes and watts respectively.)
//(虽然该值产生最高分辨率，但通常为Current_LSB选择一个值，使其与高于该值的最接近的整数相匹配，以简化电流寄存器（04h）和功率寄存器（03h）分别转换为安培和瓦的过程。)
//CAL = 0.00512 / (Current_LSB * R·SHUNT) = 0.00512 / (0.00005A * 0.1R) = 1024 = 0x0400
//Power_LSB = Current_LSB * 25 = 0.05mA * 25 = 1.25mW
//(手册：The power LSB has a fixed ratio to the Current_LSB of 25)
//(power LSB与Current_LSB的固定比率为25)

float voltageVal  ;
float Shunt_voltage ;
float Shunt_Current  ;
float Power ;

float voltageValB  ;
float Shunt_voltageB  ;
float Shunt_CurrentB  ;
float PowerB  ;
/* 创建处理线程 */
int INA226_INIT(void);
//计算平均电流
//float calculateAverage(float values[],int size);


#endif /* APPLICATIONS_INA226_I2C_H_ */
